const Clutter = imports.gi.Clutter;
const St = imports.gi.St;
+const Main = imports.ui.main;
+
const EDGE_THRESHOLD = 20;
const DRAG_DISTANCE = 80;
Name: 'EdgeDragAction',
Extends: Clutter.GestureAction,
- _init : function(side) {
+ _init : function(side, allowedModes) {
this.parent();
this._side = side;
+ this._allowedModes = allowedModes;
this.set_n_touch_points(1);
global.display.connect('grab-op-begin', Lang.bind(this, function() {
if (this.get_n_current_points() == 0)
return false;
+ if (!(this._allowedModes & Main.keybindingMode))
+ return false;
+
let [x, y] = this.get_press_coords(0);
let monitorRect = this._getMonitorRect(x, y);
this._messageTrayMenuButton.actor.connect('key-press-event',
Lang.bind(this, this._onTrayButtonKeyPress));
- let gesture = new EdgeDragAction.EdgeDragAction(St.Side.BOTTOM);
+ let gesture = new EdgeDragAction.EdgeDragAction(St.Side.BOTTOM,
+ Shell.KeyBindingMode.NORMAL |
+ Shell.KeyBindingMode.OVERVIEW);
gesture.connect('activated', Lang.bind(this, this.toggle));
global.stage.add_action(gesture);
},
},
vfunc_gesture_prepare : function(action, actor) {
- return this.get_n_current_points() == this.get_n_touch_points();
+ return Main.keybindingMode == Shell.KeyBindingMode.NORMAL &&
+ this.get_n_current_points() == this.get_n_touch_points();
},
_getBoundingRect : function(motion) {
let gesture;
- gesture = new EdgeDragAction.EdgeDragAction(St.Side.LEFT);
+ gesture = new EdgeDragAction.EdgeDragAction(St.Side.LEFT,
+ Shell.KeyBindingMode.NORMAL);
gesture.connect('activated', Lang.bind(this, function() {
if (Main.overview.visible)
Main.overview.hide();
},
vfunc_gesture_prepare : function(action, actor) {
- return this.get_n_current_points() == this.get_n_touch_points();
+ let allowedModes = Shell.KeyBindingMode.NORMAL | Shell.KeyBindingMode.OVERVIEW;
+ return this.get_n_current_points() == this.get_n_touch_points() &&
+ (allowedModes & Main.keybindingMode);
},
vfunc_gesture_end : function(action, actor) {
},
vfunc_gesture_prepare : function(action, actor) {
- if (Main.overview.visible) {
+ if (Main.keybindingMode != Shell.KeyBindingMode.NORMAL) {
this.cancel();
return false;
}